<!DOCTYPE html>
<html>
<head>
<title>提问-问答中心</title>
<meta name="renderer" content="webkit" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=0,minimal-ui" />
<link href="{eju:global name='web_cmspath' /}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="applicable-device"content="mobile">
{eju:static file="ask/skin/css/ask.css" /}
{eju:static file="/public/static/common/js/jquery.min.js"/}
{eju:static file="/public/plugins/layer-v3.1.0/layer.js"/}
{eju:static file="ask/skin/js/ask.js"/}

{eju:static file="skin/css/public.css" /}
{eju:static file="ask/skin/css/AskCommonCss.css" /}
{eju:static file="ask/skin/css/add.css" /}
{eju:static file="ask/skin/css/navigation20141112.css" /}


</head>

<body>
<!-- 头部 --> 
{eju:include file="header.htm"/} 
<!-- END -->
<script type="text/javascript">
    window.UEDITOR_HOME_URL = "__ROOT_DIR__/public/plugins/Ueditor/";
</script>
{eju:static file="/public/plugins/Ueditor/ueditor.config.js"/}
{eju:static file="/public/plugins/Ueditor/ueditor.all.min.js"/}
{eju:static file="/public/plugins/Ueditor/lang/zh-cn/zh-cn.js"/}
<div class="askBox-area s2" style="display:block;">
    <input type="hidden" id="aid" value="{$eju.field.aid}"/>
    <div class="ask-intro">
        <h3>请描述您的问题 <span class="f12">（必填）</span></h3>
        <div class="input-wrapper">
            <div class="inputBox" style="border: 1px solid#ddd;border-radius: 2px;padding: 13px 18px;height: 46px;">
                <input style="    border: none;display: block;float: left; width: 220px;overflow: hidden;font-size: 14px;outline: 0;height: 18px;line-height: 18px;}" type="text"  name="title" id="title" placeholder="最少输入6个字哦~" class="input-cont" />
                <!--<span class="input-count"><em id="asktitlenum">0</em>/50</span>-->
            </div>
        </div>
    </div>
    <div class="supply-cont clearfix" style="margin-top: 5px;">
        <div class="supply-btnbox clearfix">
            <div class="supply-btn" id="showsupplementcontext"> 问题描述</div>
        </div>
        <div class="supply-area" id="supplementcontext" style="padding: 0px 0px 0px 0px;">
            <textarea placeholder="请输入补充内容" class="span12 ckeditor" id="content" name="content" style="width: 75%;"></textarea>
        </div>
    </div>
    <div style="height: 30px;">
        <a style="display: block;float: right;border-radius: 4px;width: 120px;height: 32px;line-height: 32px;text-align: center;color: #fff;font-size: 14px;margin: 10px 0 0 0;background: #ff5200;" href="javascript:void(0);" class="btn-submit" data-url="{$eju.field.SubmitAddAsk}" onclick="SubmitData(this);">提交问题</a>
    </div>
</div>
<script type="text/javascript">
    UE.getEditor('content',{
        serverUrl :"{:url('user/Uploadify/index',array('savepath'=>'weapp'))}",
        zIndex: 1,
        initialFrameWidth: "135%", //初化宽度
        initialFrameHeight: 300, //初化高度
        focus: false, //初始化时，是否让编辑器获得焦点true或false
        maximumWords: 99999,
        removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
        pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
        autoHeightEnabled: false,
        toolbars: [["forecolor", "backcolor", "removeformat", "|", "simpleupload", "unlink"]],
    });

    //必须在提交前渲染编辑器；
    function content() {
        //判断编辑模式状态:0表示【源代码】HTML视图；1是【设计】视图,即可见即所得；-1表示不可用
        if(UE.getEditor("content").queryCommandState('source') != 0) {
            UE.getEditor("content").execCommand('source'); //切换到【设计】视图
        }
    }
</script>
<script type="text/javascript">
    function layer_loading(msg){
        var loading = layer.msg(
            msg+'...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请勿刷新页面',
            {
                icon: 1,
                time: 3600000, //1小时后后自动关闭
                shade: [0.2] //0.1透明度的白色背景
            });
        //loading层
        var index = layer.load(3, {
            shade: [0.1,'#fff'] //0.1透明度的白色背景
        });

        return loading;
    }
    function SubmitData(obj) {
        if (!$('#title').val()) {
            layer.msg('请填写问题标题！', {time: 1500, icon: 2});
            $('#title').focus();
            return false;
        }
        if (!UE.getEditor("content").getContent()) {
            layer.msg('请填写问题描述！', {time: 1500, icon: 2});
            return false;
        }
        var aid = $('#aid').val();
        var title = $('#title').val();
        var content = UE.getEditor("content").getContent();
        layer_loading('正在处理');
        $.ajax({
            url: $(obj).data('url'),
            data: {aid:aid,title:title,content:content},
            type:'post',
            dataType:'json',
            success:function(res){
                layer.closeAll();
                if (1 == res.code) {
                    layer.msg(res.msg, {time: 1000},function(){
                        window.location.replace(res.url);
                    });
                } else {
                    layer.msg(res.msg, {time: 1500, icon: 2});
                }
            },
            error : function() {
                layer.closeAll();
                layer.alert('网络失败，请刷新页面后重试', {icon: 5, closeBtn: 0});
            }
        });
    }
</script> 
{eju:include file="footer.htm"/}
{eju:static file="skin/js/jquery-3.2.1.min.js" /}
{eju:static file="skin/js/swiper-3.4.2.min.js" /}
{eju:static file="skin/js/nav.js" /}
{eju:static file="skin/js/method.js" /}
{eju:static file="skin/css/layer-animate.css" /}
{eju:static file="skin/js/search_public.js" /}
<!--底部优惠开始-->
{eju:include file="youhui.htm"/}
<!--底部优惠结束-->
<!--搜索弹出层开始-->
{eju:include file="so.htm"/}
</body>
</html>